package com.sjd.mall.enums;

import org.springframework.util.ObjectUtils;

/**
 * 订单状态
 * 字典：order_status
 *
 * @author seer
 * @version 1.0
 * @date 2022/1/13 16:28
 */
public enum OrderStatus {

    /**
     * 订单创建
     */
    CREATE_SUCCESS(1, "订单创建"),

    /**
     * 订单取消
     */
    CANCEL_SUCCESS(2, "订单取消"),

    /**
     * 支付成功
     */
    PAY_SUCCESS(3, "支付成功"),

    /**
     * 订单退款
     */
    REFUND_SUCCESS(4, "订单退款"),

    /**
     * 订单发货
     */
    DELIVER_SUCCESS(5, "订单发货"),

    /**
     * 确认收货
     */
    RECEIPT_SUCCESS(6, "确认收货");

    public Integer value;

    public String label;

    OrderStatus(Integer value, String label) {
        this.value = value;
        this.label = label;
    }

    public static String label(int value) {
        for (OrderStatus aEnum : values()) {
            if (ObjectUtils.nullSafeEquals(aEnum.value, value)) {
                return aEnum.label;
            }
        }
        return null;
    }
}
